<template>
  <header>
    <div class="l-content">
      <el-button icon="el-icon-menu" size="mini" class="btn"></el-button>
      <h3>首页</h3>
    </div>
    <div class="r-content">
      <el-dropdown trigger="click" size="mini">
        <span>
          <img class="user" :src="userImg">
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>
            <span @click="toPeopleMessage">个人中心</span>
          </el-dropdown-item>
          <el-dropdown-item @click.native="loginout">退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </header>
</template>

<script>
export default {
  name: "CommonHeader",
  data() {
    return {
      userImg: require('../assets/images/user.jpg')
    }
  },
  methods: {
    toPeopleMessage(){
      this.$router.replace('/peopleMessage/message1')
    },
    loginout(){
      this.$router.replace({name:'login'});
      console.log(1)
    }
  }
}
</script>

<style lang="less" scoped>
header {
  display: flex;
  height: 100%;
  justify-content: space-between;
  align-items: center;
}

.l-content {
  display: flex;
  overflow: hidden;
  align-items: center;

  .el-button {
    margin-right: 20px;
  }
}

.r-content {
  .user {
    margin-top: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
}
</style>
